package com.jingtuo.android.common.os;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * 如果是icon,长=宽,需要设置setIconSize();
 * 
 * @author 28173_000
 *
 */
public class BitmapInfo implements Parcelable{
	
	public static final String TYPE_RES = "resources";
	
	public static final String TYPE_ASSETS = "assets";

	public static final String TYPE_FILE = "file";

	public static final String TYPE_URL = "url";
	
	public static final String TYPE_FTP = "ftp";
	
	private String path;
	
	private String type = "";	
	
	private boolean icon;
	
	/**
	 * icon的尺寸
	 */
	private int iconSize;
	
	private int dstWidth;
	
	private int dstHeight;

	public BitmapInfo(){
		
	}
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public int getDstWidth() {
		return dstWidth;
	}

	public void setDstWidth(int dstWidth) {
		this.dstWidth = dstWidth;
	}

	public int getDstHeight() {
		return dstHeight;
	}

	public void setDstHeight(int dstHeight) {
		this.dstHeight = dstHeight;
	}

	public boolean isIcon() {
		return icon;
	}

	public void setIcon(boolean icon) {
		this.icon = icon;
	}

	/**
	 * icon的尺寸
	 * @return
	 */
	public int getIconSize() {
		return iconSize;
	}

	/**
	 * icon的尺寸
	 * @param iconSize
	 */
	public void setIconSize(int iconSize) {
		this.iconSize = iconSize;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		dest.writeString(path);
		dest.writeString(type);
		dest.writeValue(icon);
		dest.writeInt(iconSize);
		dest.writeInt(dstWidth);
		dest.writeInt(dstHeight);
	}
	
	
	public static final Parcelable.Creator<BitmapInfo> CREATOR =new Creator<BitmapInfo>() {
		
		@Override
		public BitmapInfo[] newArray(int size) {
			// TODO Auto-generated method stub
			return new BitmapInfo[size];
		}
		
		@Override
		public BitmapInfo createFromParcel(Parcel source) {
			// TODO Auto-generated method stub
			return new BitmapInfo(source);
		}
	};
	
	
	private BitmapInfo(Parcel source){
		this.path = source.readString();
		this.type = source.readString();
		this.icon = (Boolean)source.readValue(Boolean.class.getClassLoader());
		this.iconSize = source.readInt();
		this.dstWidth = source.readInt();
		this.dstHeight = source.readInt();
	}
}
